package dao;

import model.User;

import java.util.List;

/**
 * The interface User dao.
 */
public interface UserDao {
    /**
     * Insert int.
     *
     * @param user the user
     * @return the int
     */
    int insert(User user);

    /**
     * Delete int.
     *
     * @param id the id
     * @return the int
     */
    int delete(int id);

    /**
     * Update int.
     *
     * @param user the user
     * @return the int
     */
    int update(User user);

    /**
     * Find by id user.
     *
     * @param id the id
     * @return the user
     */
    User findById(long id);

    /**
     * Find all list.
     *
     * @param pageIndex the page index
     * @param pageSize  the page size
     * @return the list
     */
    List<User> findAll(int pageIndex, int pageSize);

    /**
     * Page count int.
     *
     * @return the int
     */
    int pageCount();

    /**
     * Find by name int.
     *
     * @param name the name
     * @return the int
     */
    int findByName(String name);

    /**
     * Find by phone int.
     *
     * @param phone the phone
     * @return the int
     */
    int findByPhone(String phone);

    /**
     * Find by emile int.
     *
     * @param email the email
     * @return the int
     */
    int findByEmile(String email);

    /**
     * Find by part name list.
     *
     * @param partName  the part name
     * @param pageIndex the page index
     * @param pageSize  the page size
     * @return the list
     */
    List<User> findByPartName(String partName, int pageIndex, int pageSize);


    /**
     * Login user.
     *
     * @param username the username
     * @param password the password
     * @return the user
     */
    User login(String username, String password);

    /**
     * Page count by name int.
     *
     * @param username the username
     * @return the int
     */
    int pageCountByName(String username);
    int findIdByName(String username);
}
